package org.dzq.designmode.factory.simplefactory;

import org.dzq.designmode.factory.simplefactory.bean.HuaWeiPhone;
import org.dzq.designmode.factory.simplefactory.bean.Phone;
import org.dzq.designmode.factory.simplefactory.bean.XiaoMiPhone;

/**
 * @ClassName: SimpleFactory
 * @Package: org.dzq.designmode.factory.simplefactory
 * @author: 越
 * @date: 2023/6/12 22:24
 * @Description: 简单工厂模式
 */
public class SimpleFactory {

    public Phone getPhone (String branch){
        Phone phone = null;
        if ("X".equals(branch)) {
            phone = new XiaoMiPhone();
        }else if("H".equals(branch)){
            phone = new HuaWeiPhone();
        }
        return phone;
    }
}
